import axios from '@/libs/api.request'
import config from '@/config'

export const getCustomerTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'CustomerService.view',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const editCustomerRecord = async (playload) => {
  const data = {
    module: 'CustomerService.update',
    ...playload
  }
  const resp = await axios.request({
    url: config.postUrl,
    data,
    method: 'post'
  })
  return resp
}

// 获取内部销售列表
export const getCustomerInsideNameList = async () => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'UserService.namelist'
    },
    method: 'get'
  })
  return resp.data
}

// export const editCustomerRecord = async (playload) => {
//   let module_name = 'ContentService.add'
//   if (playload.id && playload.id !== '') {
//     module_name = 'ContentService.update'
//   }
//   const data = {
//     module: module_name,
//     ...playload
//   }
//   const resp = await axios.request({
//     url: config.postUrl,
//     data,
//     method: 'post'
//   })
//   return resp
// }
